package Fuente;
import Comun.clsSaicFrame;
import javax.swing.ComboBoxModel;

public class Pacientes extends clsSaicFrame {
    int padre;
    boolean ban=false;
private javax.swing.JFormattedTextField.AbstractFormatterFactory for1;
    public Pacientes(int x) {
        padre=x;
        initComponents();
        
       for1=(this.dataMaskedTextField1.getFormatterFactory());
       this.dataMaskedTextField1.setFormatterFactory(null);
        try {
       this.dataSource1.consulta();
        }
        catch (NullPointerException ex){
                    new Error(this,true,"Se ha perdido la Conexion a la Base de  Datos",0,"¡ERROR!").setVisible(true);
                    System.exit(0);
            }
    }
public void limpiar(){
    this.dataTextField1.setText("");
    this.dataTextField2.setText("");
    this.dataTextField3.setText("");
    this.dataMaskedTextField1.setText("");
    this.dataRadioButton1.setSelected(false);
    this.dataRadioButton2.setSelected(false);
    this.dataCombobox1.setSelectedIndex(0);
    this.dataCombobox2.setSelectedIndex(0);
}
public void activar(){
    this.datahabilitador1.habilitaredison(panel1, this.dataTextField1);
    this.dataMaskedTextField1.setEnabled(true);
    this.datahabilitador1.habilitaredison(panel1, this.dataRadioButton1);
    this.datahabilitador1.habilitaredison(panel1, this.dataCombobox1);
}
public void desactivar(){
    this.datahabilitador1.deshabilitaredison(panel1, this.dataTextField1);
    this.dataMaskedTextField1.setEnabled(false);
    this.datahabilitador1.deshabilitaredison(panel1, this.dataRadioButton1);
    this.datahabilitador1.deshabilitaredison(panel1, this.dataCombobox1);
}
  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        dataSource1 = new FuenteDeDatos.DataSource();
        datahabilitador1 = new FuenteDeDatos.Datahabilitador();
        panel1 = new Comun.PanelRoundTranslucido();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        buttonSeven1 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven2 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven3 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven4 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven5 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven6 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven7 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven8 = new org.edisoncor.gui.button.ButtonSeven();
        buttonSeven9 = new org.edisoncor.gui.button.ButtonSeven();
        dataMaskedTextField1 = new FuenteDeDatos.DataMaskedTextField();
        dataTextField1 = new FuenteDeDatos.DataTextField();
        dataTextField2 = new FuenteDeDatos.DataTextField();
        dataTextField3 = new FuenteDeDatos.DataTextField();
        dataRadioButton1 = new FuenteDeDatos.DataRadioButton();
        dataRadioButton2 = new FuenteDeDatos.DataRadioButton();
        dataCombobox1 = new FuenteDeDatos.DataCombobox();
        dataCombobox2 = new FuenteDeDatos.DataCombobox();

        dataSource1.setCodigosql("select * from tbl_paciente");
        dataSource1.setDb("db_saic");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Pacientes");
        setBackground(new java.awt.Color(51, 153, 255));

        jLabel1.setBackground(new java.awt.Color(255, 255, 255));
        jLabel1.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 30));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Catálogo de Pacientes");

        jLabel2.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel2.setText("C.U.R.P.");

        jLabel3.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel3.setText("Nombre:");

        jLabel4.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel4.setText("Apellido Paterno:");

        jLabel5.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel5.setText("Apellido  Materno:");

        jLabel6.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel6.setText("Sexo:");

        jLabel7.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel7.setText("Tipo de Sangre:");

        buttonSeven1.setText("Guardar");
        buttonSeven1.setEnabled(false);
        buttonSeven1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven1ActionPerformed(evt);
            }
        });

        buttonSeven2.setText("Modificar");
        buttonSeven2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven2ActionPerformed(evt);
            }
        });

        buttonSeven3.setText("Cancelar");
        buttonSeven3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven3ActionPerformed(evt);
            }
        });

        buttonSeven4.setText("Nuevo");
        buttonSeven4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                buttonSeven4MouseClicked(evt);
            }
        });
        buttonSeven4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven4ActionPerformed(evt);
            }
        });

        buttonSeven5.setText("<<");
        buttonSeven5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven5ActionPerformed(evt);
            }
        });

        buttonSeven6.setText("<");
        buttonSeven6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven6ActionPerformed(evt);
            }
        });

        buttonSeven7.setText(">");
        buttonSeven7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven7ActionPerformed(evt);
            }
        });

        buttonSeven8.setText(">>");
        buttonSeven8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven8ActionPerformed(evt);
            }
        });

        buttonSeven9.setText("Buscar");
        buttonSeven9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSeven9ActionPerformed(evt);
            }
        });

        dataMaskedTextField1.setCampo("paciente_id");
        dataMaskedTextField1.setData(dataSource1);
        dataMaskedTextField1.setEnabled(false);
        try {
            dataMaskedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("UUUU######UUUUUU##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        dataMaskedTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dataMaskedTextField1ActionPerformed(evt);
            }
        });
        dataMaskedTextField1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                dataMaskedTextField1FocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                dataMaskedTextField1FocusLost(evt);
            }
        });

        dataTextField1.setCampo("nombre");
        dataTextField1.setData(dataSource1);
        dataTextField1.setEnabled(false);

        dataTextField2.setCampo("apellido_p");
        dataTextField2.setData(dataSource1);
        dataTextField2.setEnabled(false);

        dataTextField3.setCampo("apellido_m");
        dataTextField3.setData(dataSource1);
        dataTextField3.setEnabled(false);

        dataRadioButton1.setForeground(new java.awt.Color(255, 255, 255));
        dataRadioButton1.setText("Masculino");
        dataRadioButton1.setCampo("sexo");
        dataRadioButton1.setData(dataSource1);
        dataRadioButton1.setEnabled(false);
        dataRadioButton1.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        dataRadioButton1.setValor("M");
        dataRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dataRadioButton1ActionPerformed(evt);
            }
        });

        dataRadioButton2.setForeground(new java.awt.Color(255, 255, 255));
        dataRadioButton2.setText("Femenino");
        dataRadioButton2.setCampo("sexo");
        dataRadioButton2.setData(dataSource1);
        dataRadioButton2.setEnabled(false);
        dataRadioButton2.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 16));
        dataRadioButton2.setValor("F");
        dataRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dataRadioButton2ActionPerformed(evt);
            }
        });

        dataCombobox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "A", "B", "AB", "O" }));
        dataCombobox1.setCampo("tipo_sangre");
        dataCombobox1.setData(dataSource1);
        dataCombobox1.setEnabled(false);

        dataCombobox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "+", "-" }));
        dataCombobox2.setCampo("rh");
        dataCombobox2.setData(dataSource1);
        dataCombobox2.setEnabled(false);

        org.jdesktop.layout.GroupLayout panel1Layout = new org.jdesktop.layout.GroupLayout(panel1);
        panel1.setLayout(panel1Layout);
        panel1Layout.setHorizontalGroup(
            panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(panel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(panel1Layout.createSequentialGroup()
                        .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 942, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(panel1Layout.createSequentialGroup()
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(panel1Layout.createSequentialGroup()
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 147, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 147, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(18, 18, 18)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(dataTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                                    .add(dataTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                                    .add(dataTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                                    .add(dataMaskedTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE))
                                .add(116, 116, 116))
                            .add(panel1Layout.createSequentialGroup()
                                .add(31, 31, 31)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel7)
                                    .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(18, 18, 18)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(panel1Layout.createSequentialGroup()
                                        .add(dataCombobox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(49, 49, 49)
                                        .add(dataCombobox2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(panel1Layout.createSequentialGroup()
                                        .add(dataRadioButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(47, 47, 47)
                                        .add(dataRadioButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 71, Short.MAX_VALUE)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(panel1Layout.createSequentialGroup()
                                .add(1, 1, 1)
                                .add(buttonSeven2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(buttonSeven3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(panel1Layout.createSequentialGroup()
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(panel1Layout.createSequentialGroup()
                                        .add(buttonSeven5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 60, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .add(buttonSeven6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(buttonSeven4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(panel1Layout.createSequentialGroup()
                                        .add(buttonSeven7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(buttonSeven8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 62, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                    .add(buttonSeven1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                            .add(panel1Layout.createSequentialGroup()
                                .add(67, 67, 67)
                                .add(buttonSeven9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .add(93, 93, 93))))
        );
        panel1Layout.setVerticalGroup(
            panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(panel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .add(18, 18, 18)
                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(panel1Layout.createSequentialGroup()
                        .add(3, 3, 3)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataMaskedTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(30, 30, 30)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataRadioButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataRadioButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataCombobox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(dataCombobox2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(panel1Layout.createSequentialGroup()
                        .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(panel1Layout.createSequentialGroup()
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(buttonSeven5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(buttonSeven6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(buttonSeven7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(buttonSeven8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(18, 18, 18)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(buttonSeven4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(buttonSeven1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                            .add(panel1Layout.createSequentialGroup()
                                .add(105, 105, 105)
                                .add(panel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(buttonSeven3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(buttonSeven2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                        .add(18, 18, 18)
                        .add(buttonSeven9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(51, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(panel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(panel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonSeven4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven4ActionPerformed
        this.datahabilitador1.deshabilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(true);
        this.buttonSeven3.setEnabled(true);
        this.limpiar();
        this.activar();
    }//GEN-LAST:event_buttonSeven4ActionPerformed

    private void buttonSeven1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven1ActionPerformed
       String genero="", resp="";
        if(this.dataRadioButton1.isSelected()){
        genero="M";
        }else if(this.dataRadioButton2.isSelected()){
        genero="F";
        }

       if(ban==true){
           resp= this.dataSource1.ejecutarPA("call sp_modificar_paciente ('"+this.dataMaskedTextField1.getText()+"','"+this.dataTextField1.getText()+"','"+
            this.dataTextField2.getText()+"','"+this.dataTextField3.getText()+"','"+genero+"','"+this.dataCombobox1.getSelectedItem()+
            "','"+this.dataCombobox2.getSelectedItem()+"',"+this.padre+",@r);");
        new Error(this,true,resp,0,"¡ATENCION!").setVisible(true);

        if(resp.equals("Modificación Hecha")){
            this.limpiar();
            this.desactivar();
            this.datahabilitador1.habilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(false);
        this.dataSource1.consulta();
        ban=false;
        }
        else if(resp.equals("Usted no puede Modificar este Paciente")){
            this.desactivar();
        this.datahabilitador1.habilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(false);
        this.dataSource1.consulta();
        ban=false;
        
        }
       }else{
      resp= this.dataSource1.ejecutarPA("call sp_insertar_paciente ('"+this.dataMaskedTextField1.getText()+"','"+this.dataTextField1.getText()+"','"+
            this.dataTextField2.getText()+"','"+this.dataTextField3.getText()+"','"+genero+"','"+this.dataCombobox1.getSelectedItem()+
            "','"+this.dataCombobox2.getSelectedItem()+"',"+this.padre+",@r);");
        new Error(this,true,resp,0,"¡ATENCION!").setVisible(true);

        if(resp.equals("Paciente Agregado Correctamente")){
            this.limpiar();
            this.desactivar();
         this.datahabilitador1.habilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(false);
        this.dataSource1.consulta();
        }
       }
    }//GEN-LAST:event_buttonSeven1ActionPerformed

    private void buttonSeven7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven7ActionPerformed
       this.dataSource1.siguiente();
    }//GEN-LAST:event_buttonSeven7ActionPerformed

    private void buttonSeven6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven6ActionPerformed
    this.dataSource1.anterior();
    }//GEN-LAST:event_buttonSeven6ActionPerformed

    private void buttonSeven5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven5ActionPerformed
    this.dataSource1.primero();
    }//GEN-LAST:event_buttonSeven5ActionPerformed

    private void buttonSeven8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven8ActionPerformed
        this.dataSource1.ultimo();
    }//GEN-LAST:event_buttonSeven8ActionPerformed

    private void buttonSeven4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_buttonSeven4MouseClicked

    }//GEN-LAST:event_buttonSeven4MouseClicked

    private void dataRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataRadioButton1ActionPerformed
      this.dataRadioButton2.setSelected(false);
    }//GEN-LAST:event_dataRadioButton1ActionPerformed

    private void dataRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataRadioButton2ActionPerformed
        this.dataRadioButton1.setSelected(false);
    }//GEN-LAST:event_dataRadioButton2ActionPerformed

    private void buttonSeven9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven9ActionPerformed
        ComboBoxModel modelo=(new javax.swing.DefaultComboBoxModel(new String[] {"CURP" ,"Nombre", "ApellidoP", "ApellidoM" }));
        new busqueda(this,true,"vw_pacientes",modelo,this.dataSource1,"BUSQUEDA DE PACIENTES","rptPacientes").activar();
    }//GEN-LAST:event_buttonSeven9ActionPerformed

    private void buttonSeven2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven2ActionPerformed
        this.activar();
        ban=true;
        this.dataMaskedTextField1.setEnabled(false);
        this.datahabilitador1.deshabilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(true);
        this.buttonSeven3.setEnabled(true);
    }//GEN-LAST:event_buttonSeven2ActionPerformed

    private void dataMaskedTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataMaskedTextField1ActionPerformed

    }//GEN-LAST:event_dataMaskedTextField1ActionPerformed

    private void dataMaskedTextField1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dataMaskedTextField1FocusGained
        this.dataMaskedTextField1.setFormatterFactory(for1);
    }//GEN-LAST:event_dataMaskedTextField1FocusGained

    private void dataMaskedTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dataMaskedTextField1FocusLost

        this.dataMaskedTextField1.setFormatterFactory(null);
    }//GEN-LAST:event_dataMaskedTextField1FocusLost

    private void buttonSeven3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSeven3ActionPerformed
        this.limpiar();
        this.desactivar();
        this.datahabilitador1.habilitaredison(panel1, this.buttonSeven1);
        this.buttonSeven1.setEnabled(false);
        this.dataSource1.consulta();
        ban=false;
    }//GEN-LAST:event_buttonSeven3ActionPerformed

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Pacientes(1).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.edisoncor.gui.button.ButtonSeven buttonSeven1;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven2;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven3;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven4;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven5;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven6;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven7;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven8;
    private org.edisoncor.gui.button.ButtonSeven buttonSeven9;
    private FuenteDeDatos.DataCombobox dataCombobox1;
    private FuenteDeDatos.DataCombobox dataCombobox2;
    private FuenteDeDatos.DataMaskedTextField dataMaskedTextField1;
    private FuenteDeDatos.DataRadioButton dataRadioButton1;
    private FuenteDeDatos.DataRadioButton dataRadioButton2;
    private FuenteDeDatos.DataSource dataSource1;
    private FuenteDeDatos.DataTextField dataTextField1;
    private FuenteDeDatos.DataTextField dataTextField2;
    private FuenteDeDatos.DataTextField dataTextField3;
    private FuenteDeDatos.Datahabilitador datahabilitador1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private Comun.PanelRoundTranslucido panel1;
    // End of variables declaration//GEN-END:variables
}